#!/usr/bin/env python
# _*_ coding: utf-8 _*_
# @Time    : 2017/7/10 0010 下午 16:34
# @Author  : Jython ijython@qq.com
# @File    : test.py
import re
d="${subjectId} and teacher_id =${teacherInfo}[0][teacherId] GROUP  ${teacherInfo}[0][teach][teache] sdf${teacherInf-o}[0][teach][teache] ssfdsd  ${teacherInf-o}[0]"
print re.compile(r"(\$\{\D+?\}(\[.+?\])*)").findall(d)
print re.compile(r'(\$\{.+?)\s').findall(d)